import request from "@/util/api.js"


/**
 * 获取用户收货地址列表
 * @param {Object} data
 */
export function getUserAddressListApi(data) {
	return request.get('user/address/lst', data ? data : {
		limit: 100
	})
}

/**
 * 获取所有会员
 */
export function getVipListApi() {
	return request.get('grade/list')
}

/**
 * 获取用户收藏商品
 * @param {*} data 
 */
export function getUserCollectionProductApi(data) {
	return request.get('user/relation/product/lst')
}


/**
 * 获取用户收藏店铺
 * @param {*} data 
 */
export function getUserCollectionMerchantApi(data) {
	return request.get('user/relation/merchant/lst', data)
}


/**
 * 获取协议
 * @param {*} agreement 
 */
export function getAgreementApi(agreement) {
	return request.get(`agreement/${agreement}`)
}

/**
 * 获取用户账单记录
 * @param {*} data 
 */
export function getUserIntegralListApi(data) {
	return request.get('user/integral/lst', data)
}

/**
 * 获取用户积分info
 * @param {*} data 
 */
export function getUserIntegralInfoApi(data) {
	return request.get('user/integral/info', data)
}

/**
 * 获取用户收货地址列表
 * @param {*} data 
 */
export function getUserAddressApi(data) {
	return request.get('user/address/lst', data)
}

/**
 * 广告弹窗
 */
export function getAdvertisementApi() {
	return request.get(`popup/list`)
}

/**
 * 获取用户消息数量
 */
export function getUserNewsNumApi() {
	return request.get(`message/num`)
}

/**
 * 获取用户消息列表
 */
export function getUserNewsListApi() {
	return request.get('user/message/lst')
}

/**
 * 红包说明
 */
export function getRedExplainApi() {
	return request.get('agreement/red_packet')
}

/**
 * 获取用户已获得红包列表  非裂变型
 * @param {*} data 
 */
export function getUserRedListApi(data) {
	return request.get('red_packet/my/routine', data)
}

/**
 * 获取用户裂变型红包  裂变型不可直接用，只能分享出去领取
 * @param {Object} data
 */
export function getUserFissionRedListApi(data) {
	return request.get('red_packet/my/share/lst', data)
}

/**
 * 获取平台&商户红包，领取型
 * @param {*} data 
 */
export function getPlatformRedApi(data) {
	return request.get('red_packet/lst?packet_type', data)
}

/**
 * 用户领取平台发放领取型红包 
 * @param {*} data 
 */
export function userReceiveRedApi(data) {
	return request.post('red_packet/user/receive', data)
}

/**
 * 获取用户拥有的礼品卡
 * @param {*} data 
 */
export function getUserCardListApi(data) {
	return request.get('user/card', data)
}

/**
 * 礼品卡转余额
 * @param {*} data 
 */
export function cardExchangeApi(data) {
	return request.get('user/card_to_amount', data)
}

/**
 * 获取分享的裂变红包详情
 * @param {*} data 
 */
export function getFissionRedDetailsApi(data) {
	return request.get('red_packet/randomShareDetails', data)
}


/**
 * 用户领取红包 裂变型
 * @param {Object} data
 */
export function userGetFiRedApi(data) {
	return request.post('red_packet/receive/randomShare', data)
}

/**
 * 领取用户红包  非裂变分享型
 * @param {*} data 
 */
export function userReceiveGiveRedApi(data) {
	return request.post('red_packet/user/receive/give', data)
}

/**
 * 修改用户收货地址
 * @param {*} id 
 * @param {*} data 
 */
export function userAddressUpdateApi(id, data) {
	return request.post(`user/address/update/${id}`, data)
}

/**
 * 平台礼品卡
 */
export function cardListApi() {
	return request.get('card/list')
}

/**
 * 购买礼品卡
 * @param {*} data 
 */
export function shopCardApi(data) {
	return request.post('user/card/create/order', data)
}

/**
 * 领取用户分享赠送的礼品卡
 * @param {*} data 
 */
export function userGetShareCard(data){
	return request.post('user/get_share_card',data)
}

export function getUserInfoApi(){
	return request.get('user')
}